package com.beta.springmvc.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.portlet.ModelAndView;

/**
 * Created by yaoyt on 16/12/1.
 *
 * @author yaoyt
 */
@ControllerAdvice
public class ExceptionController {

    @ExceptionHandler
    public ModelAndView exceptionHandler(Exception ex) {
        ModelAndView mv = new ModelAndView("error");
        mv.addObject("exception", ex);
        System.out.println("global testControllerAdvice");
        return mv;
    }


}
